package com.graduation.rescuematerial.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.graduation.rescuematerial.dto.StatisticsDTO;
import com.graduation.rescuematerial.dto.SysMaterialDTO;
import com.graduation.rescuematerial.pojo.Material;
import com.graduation.rescuematerial.vo.ApplicableByWareHouseNameVo;
import com.graduation.rescuematerial.vo.BaseMaterialVo;
import com.graduation.rescuematerial.vo.MaterialBaseVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author CaiShuangLian
 * @since 2022-04-22
 */
@Mapper
public interface MaterialMapper extends BaseMapper<Material> {

    //小程序端获取可申请物资（可能需要修改）
    List<MaterialBaseVo> getApplicableMaterial();

    //小程序端获取物资统计
    StatisticsDTO getStatistics(String companyName);

    //根据key模糊查询本部门的物资
    List<MaterialBaseVo> fuzzyQuery(HashMap map);

    //系统管理员获取全部物资
    List<SysMaterialDTO> getAllMaterial();

    //系统管理员修改物资
    int updateMaterialInfo(BaseMaterialVo baseMaterial);

    //系统管理员添加物资
    int addOne(BaseMaterialVo baseMaterial);

    //系统管理员模糊查询本部门物资
    List<SysMaterialDTO> SysFuzzyQuery(String key);

    //小程序端获取本部门全部物资
    List<MaterialBaseVo> getAllMaterialByCompanyName(String companyName);

    //小程序端根据目录id获取本部门的物资
    List<SysMaterialDTO> getAllByCatalog(@Param("companyName") String companyName, @Param("catalogId") Integer catalogId);

    //获取仓库下可申请物资（可按目录分类，可按照关键字查询，catalog和keyword联合查询）
    List<MaterialBaseVo> getApplicableMaterialByWareHouseName(ApplicableByWareHouseNameVo applicable);

    List<StatisticsDTO> getMaterialStatistics(String companyName);
}
